package xyz.chenyongpeng.orderconsumerdubbo.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.chenyongpeng.entity.ZsResourceCategory;
import xyz.chenyongpeng.orderconsumerdubbo.vo.ResourceCategoryVo;
import xyz.chenyongpeng.service.IZsResourceCategoryService;

import java.util.ArrayList;
import java.util.List;

@Service
public class ResourceCategoryService {

    @Autowired
    private IZsResourceCategoryService zsResourceCategoryService;

    public List<ResourceCategoryVo> getAll() {
        List<ZsResourceCategory> zsResourceCategory = zsResourceCategoryService.list(null);
        List<ResourceCategoryVo> data = new ArrayList<>();
        for (ZsResourceCategory category : zsResourceCategory) {
            ResourceCategoryVo vo = new ResourceCategoryVo(category.getRcId(), category.getRcTitle());
            data.add(vo);
        }
        return data;
    }
}
